# -*- coding:utf-8 -*-
class ListNode:
    def __init__(self, x):
        self.val = x
        self.next = None


class Solution:
    def deleteDuplication(self, pHead):
        # write code here
        if not pHead:
            return None
        l1 = l2 = ListNode(-1)
        l1.next = pHead
        first = pHead
        last = l1
        while first != None and first.next != None:
            if first.val != first.next.val:
                first = first.next
                last = last.next
            else:
                cur = first.val
                while first and cur == first.val:
                    first = first.next
                last.next = first
        return l2.next


node1 = ListNode(1)
node2 = ListNode(1)
node3 = ListNode(1)
node4 = ListNode(1)
node5 = ListNode(1)
node6 = ListNode(1)
node7 = ListNode(1)
node1.next = node2
node2.next = node3
node3.next = node4
node4.next = node5
node5.next = node6
node6.next = node7

s = Solution()
s.deleteDuplication(node1)
i=node1
while i!=None:
    print(i.val)
    i=i.next